#ifndef UTILITY_H_INCLUDED
#define UTILITY_H_INCLUDED

#include "types.h"

#include <ctime>
#include <string>
#include <sstream>

namespace stdf {

ByteOrder getNativeByteOrder(void);

std::string    time2string(int time);


#if 0
template<typename T>
std::string    toString( T& val) {
    stringstream sstr;
    sstr << val;
    return sstr.str();
}
#endif

std::string toString(unsigned short& val);
std::string toString(unsigned char& val);
std::string toString(char& val);

std::string toString(short& val);
std::string toString(int& val);
std::string toString(unsigned int& val);
std::string toString(long int& val);
std::string toString(unsigned long int& val);
std::string toString(float& val);
std::string toString(double& val);
std::string toString(CN& val);
std::string toString(BN& val);
std::string toString(DN& val);

template<typename T>
std::string toString( std::vector< T >& val) {
    stringstream sstr;
    for(unsigned int i=0; i < val.size(); i++)
        sstr << toString(val[i]) << ' ';
    return sstr.str();
}

//std::string toString( CN& val) {
//    return val.str();
//}

void translate( char* pBuf, unsigned int size, bool swap);
void translate( char* src, char* dest, unsigned int size, bool swap);

} // end namespace

#endif // UTILITY_H_INCLUDED
